<SCRIPT language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</SCRIPT>
<?
session_start();
include("db.php");
$zen=500000;
if(!isset($_POST['char']) AND isset($_SESSION['login'])){
	echo "<script>window.location='pkclear.php'</script>";
}
else if(!isset($_SESSION['login'])){
	echo "<script>window.location='home.php'</script>";
}
else{
	$login=$_SESSION['login'];
	$char=$_POST['char'];
	$grana=mssql_query("SELECT Money FROM Character WHERE AccountID='$login' AND Name='$char'");
	$grana=mssql_fetch_row($grana);
	$sql = mssql_query("SELECT * FROM MEMB_STAT WHERE ConnectStat = 1 AND memb___id='$login'");
	$online=mssql_num_rows($sql);
}
	if($online>0){
			echo "<script>alert('Seu login esta conectado! saia do jogo para limpar o PK');window.location='pkclear.php'</script>";
		}
	else {
		if($grana[0]<$zen){
			echo "<script>alert('Voce nao tem ZEN Suficiente para limpar PK');window.location='pkclear.php'</script>";
		}
		else {
 	$msquery = "UPDATE Character SET PkLevel = '3', PkCount = '0', Money = Money-$zen, PkTime = '0' WHERE Name = '$char' AND AccountID = '$login'";
	$msresults= mssql_query($msquery);
echo "<script>alert('Voce nao esta mais PK');window.location='pkclear.php'</script>";
			
}
}


?>
